package com.cyh.pangu.offer.common;

public class ListUtils {

    public static  void printList(ListNode head) {
        ListNode data = head;
        while (data != null) {
            System.out.println("d:" + data.val);
            data = data.next;
        }
    }

    public static ListNode buildList(int[] nums) {
        ListNode head = new ListNode();
        ListNode point = head;
        for (int num : nums) {
            ListNode data = new ListNode(num);
            point.next = data;
            point = data;
        }
        return head.next;
    }
}
